﻿using Microsoft.AspNetCore.Mvc;
using SIMS.SqlSugarWebApi.DTO;
using SIMS.Shared.Models;
using SIMS.SqlSugarWebApi.ServiceInterface;

namespace SIMS.SqlSugarWebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LoginController : ControllerBase
    {
        private readonly ILoginService _loginService;

        public LoginController(ILoginService loginService)
        {
            _loginService = loginService;
        }

        [HttpPost]
        public async Task<IActionResult> Login(LoginDTO param)
        {
            var data = await _loginService.Login(param.username, param.password);
            var res = new ResponseResultModel { data = data};
            return Ok(res);
        }
    }
}
